﻿function ProcessNavBarResult()
{
	var stamp = '/stamp/' + new Date().getTime();
    var css = window.http.readyState < ReadyState.DONE ? 'color:gray' : 'color:blue';
    var tag = window.http.readyState < ReadyState.DONE ? 'u' : 'a';
    var htm = '&nbsp;';
    var spc   = '<img width=11 height=11 src="/webservices/images/clear.gif" align="absmiddle" style="margin-left:10px">';
    var plus  = '<img border=0 src="/webservices/images/plus.gif" style="margin-left:10px;margin-right:2px">';
    var minus = '<img border=0 src="/webservices/images/minus.gif" style="margin-left:10px;margin-right:2px">';
    if (Controller.SidebarState==1)
    {
        
        if (window.loggedinuser.PERM_CREATE_EVENT) htm += '<'+tag+' href="javascript:void(0)" onclick="EventCreateNew()" style="'+css+'"><b>Create New Event</b></'+tag+'>';
        else htm += '<label disabled style="font-weight:bold;color:gray">Create New Event</label>';
        
        htm += '<br><img height=1 width=160 src="/webservices/images/clear.gif"><br><br>';
        htm += spc + '<'+tag+' title="Return to Home Page" href="./#report/next5'+stamp+'" style="'+css+'">Next 10 Events</'+tag+'><br>';
        htm += spc + '<'+tag+' title="View today\'s events" href="#report/search/action/event/op/xms/s1/'+dateSQL(new Date())+''+stamp+'" style="'+css+'">Events Today</'+tag+'><br>';
//        htm += spc + '<'+tag+' title="Return to Homage Page" href="javascript:void(0)" onclick="LoadNext5Events()" style="'+css+'">Home</'+tag+'><br>';
//        htm += '<'+tag+' href="javascript:void(0)" style="margin-left:10px;color:gray">All Events</'+tag+'><br>';
        htm += spc + '<'+tag+' href="./#report/feature'+stamp+'" style="'+css+'">Featured Events</'+tag+'><br>';
//        htm += spc + '<'+tag+' href="javascript:void(0)" onclick="LoadFeaturedEvents()" style="'+css+'">Featured Events</'+tag+'><br>';
        htm += spc + '<'+tag+' title="Show only your events" href="./#report/my'+stamp+'" style="'+css+'">My Events</'+tag+'><br>';
        htm += '<a href="javascript:void(0)" onclick="ShowHideEventsByUserNode ()" style="'+css+'">';
        htm += (Controller.SidebarUserDisplayState==1?minus:plus)
        htm += '</a>';
        htm += '<a href="javascript:void(0)" onclick="ShowHideEventsByUserNode ()" style="'+css+'">';
        htm += 'Events by User';
        htm += '</a>';
        
       
       if (Controller.SidebarUserDisplayState==1)
       {
           for (var x in window.users)
           {
               htm += '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<'+tag+'';
//               htm += ' onclick="SearchEventsByUser('+window.users[x]['ID']+')"';
//               htm += ' class="small" href="javascript:void(0)"';
               htm += ' class="small" href="./#report/byuser/id/'+window.users[x]['ID']+''+stamp+'"';
               htm += '>'+window.users[x]['FirstName']+' '+window.users[x]['LastName']+'</'+tag+'>';
           }
       }
       
        /*htm += '&nbsp;&nbsp;&nbsp;&nbsp;<'+tag+' href="javascript:void(0)">Settings</'+tag+'><br>';
        htm += '&nbsp;&nbsp;&nbsp;&nbsp;<'+tag+' href="javascript:void(0)">Locks</'+tag+'><br>';
        htm += '&nbsp;&nbsp;&nbsp;&nbsp;<'+tag+' href="javascript:void(0)">Logs</'+tag+'>';*/
        htm += '<br><br>';
        htm += '&nbsp;<'+tag+' href="javascript:void(0)" onclick="location.reload()" style="'+css+'"><b>Refresh</b></'+tag+'><br><br>';
    }
    return htm;
}

function ShowHideEventsByUserNode ()
{
    Controller.SidebarUserDisplayState=-(Controller.SidebarUserDisplayState -1);
    Controller.Reload()
}